package com.sfd.api;

import com.sfd.core.service.UserService;
import com.sfd.security.api.CommonApi;
import com.sfd.core.entity.User;
import com.sfd.core.vo.LoginUser;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.Map;
import java.util.Set;

/**
 * @author haden
 * @date 2022/8/13 20:41
 **/
@Component
public class CommonApiImpl implements CommonApi {
    @Resource
    private UserService userService;

    @Override
    public User queryUserByName(String username) {
        return userService.getUserByName(username);
    }

    @Override
    public LoginUser getLoginUserByName(String name) {
        User user = userService.getUserByName(name);
        return new LoginUser(user.getId(), user.getUsername(), user.getAge(), user.getPhone(), user.getPassword());
    }

    @Override
    public Map<String, Collection<String>> getRolePermissionMap() {
        return null;
    }

    @Override
    public Set<String> queryUserRoles(String username) {
        return null;
    }

    @Override
    public Set<String> queryUserAuths(String username) {
        return null;
    }
}
